/*
 * @Author: yangzonglong
 * @Date: 2020-06-08 11:23:29
 * @version: v1.0.0
 * @Descripttion:
 * @LastEditors: yangzonglong
 * @LastEditTime: 2021-05-14 17:06:50
 * @Auditor:
 */
import { ColumnProps } from './../table/interface';
import { FormItemProps } from './../formx/interface';

export interface FieldNames {
  value: string;
  label: string;
}

export interface ModelProps {
  title: string;
  columns: ColumnProps<any>[];
  url: string;
  fieldNames: FieldNames;
  searchFields?: string[];
  searchFieldsText?: string[];
  advancedSearchFormItems?: FormItemProps[];
  query?: object;
}

export interface ModalTableInModelProps {
  showFullIcon?: boolean;
  showSelected?: string;
  moduleName?: string;
  modelName?: string;
  pageModelCode?: string; // 页面模型编码
  visible?: boolean;
  onCancel?(): void;
  onOk?(rows: any[]): void;
  syncModel?(model: ModelProps): void; // 向上同步model
  parentIsInit?: boolean; // 为true 时 会调用syncModel同步model配置
  rowSelectionType?: 'radio' | 'checkbox';
  model?: ModelProps;
  fieldNames?: FieldNames;
  width?: number;
  query?: any;
  url?: string;
  hideSearch?: boolean;
  defaultSelected?: any[];
  handleResult?(result: any): any;
  handleQuerySet?(result: any): any;
  treeStructure?: boolean;
  treeId?: string;
  treeParentId?: string;
  showAutoSearch?: boolean
}

export interface ApiModelProps {
  id: string;
  type: string;
  columns: string[];
  locales: {
    cn?: string;
    en?: string;
  };
  fieldNames: {
    value: string;
    label: string;
  };
}
